using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_INVOICEHEADERMap : EntityTypeConfiguration<SO_INVOICEHEADER>
    {
        public SO_INVOICEHEADERMap()
        {
            // Primary Key
            this.HasKey(t => new { t.DATE, t.PATIENT_PERCENTAGE, t.GUARANTOR1_PERCENTAGE, t.GUARANTOR2_PERCENTAGE, t.DISCOUNT_PERCENTAGE, t.ADMISION_ID, t.TOTAL_AMOUNT, t.PATIENT_AMOUNT, t.GUARANTOR1_AMOUNT, t.GUARANTOR2_AMOUNT, t.DISCOUNT_AMOUNT, t.PATIENT_PRICE_LIST, t.SUMFIELDS });

            // Properties
            this.Property(t => t.NUMBER)
                .HasMaxLength(8);

            this.Property(t => t.POSTED)
                .HasMaxLength(5);

            this.Property(t => t.CLOSED)
                .HasMaxLength(5);

            this.Property(t => t.PATIENT_HARDCODE)
                .HasMaxLength(5);

            this.Property(t => t.GUARANTOR1_HARDCODE)
                .HasMaxLength(5);

            this.Property(t => t.GUARANTOR2_HARDCODE)
                .HasMaxLength(5);

            this.Property(t => t.GUARANTOR2_REST)
                .HasMaxLength(5);

            this.Property(t => t.PATIENT)
                .HasMaxLength(110);

            this.Property(t => t.GUARANTOR1)
                .HasMaxLength(110);

            this.Property(t => t.GUARANTOR2)
                .HasMaxLength(110);

            this.Property(t => t.ADMISION_ID)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.PATIENT_PRICE_LIST)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR1_PRICE_LIST)
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR2_PRICE_LIST)
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR1_COVERAGE_PLAN)
                .HasMaxLength(50);

            this.Property(t => t.GUARANTOR2_COVERAGE_PLAN)
                .HasMaxLength(50);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(64);

            // Table & Column Mappings
            this.ToTable("SO_INVOICEHEADER");
            this.Property(t => t.NUMBER).HasColumnName("NUMBER");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.POSTED).HasColumnName("POSTED");
            this.Property(t => t.CLOSED).HasColumnName("CLOSED");
            this.Property(t => t.PATIENT_HARDCODE).HasColumnName("PATIENT_HARDCODE");
            this.Property(t => t.GUARANTOR1_HARDCODE).HasColumnName("GUARANTOR1_HARDCODE");
            this.Property(t => t.GUARANTOR2_HARDCODE).HasColumnName("GUARANTOR2_HARDCODE");
            this.Property(t => t.GUARANTOR2_REST).HasColumnName("GUARANTOR2_REST");
            this.Property(t => t.PATIENT).HasColumnName("PATIENT");
            this.Property(t => t.GUARANTOR1).HasColumnName("GUARANTOR1");
            this.Property(t => t.GUARANTOR2).HasColumnName("GUARANTOR2");
            this.Property(t => t.PATIENT_PERCENTAGE).HasColumnName("PATIENT_PERCENTAGE");
            this.Property(t => t.GUARANTOR1_PERCENTAGE).HasColumnName("GUARANTOR1_PERCENTAGE");
            this.Property(t => t.GUARANTOR2_PERCENTAGE).HasColumnName("GUARANTOR2_PERCENTAGE");
            this.Property(t => t.DISCOUNT_PERCENTAGE).HasColumnName("DISCOUNT_PERCENTAGE");
            this.Property(t => t.ADMISION_ID).HasColumnName("ADMISION_ID");
            this.Property(t => t.TOTAL_AMOUNT).HasColumnName("TOTAL_AMOUNT");
            this.Property(t => t.PATIENT_AMOUNT).HasColumnName("PATIENT_AMOUNT");
            this.Property(t => t.GUARANTOR1_AMOUNT).HasColumnName("GUARANTOR1_AMOUNT");
            this.Property(t => t.GUARANTOR2_AMOUNT).HasColumnName("GUARANTOR2_AMOUNT");
            this.Property(t => t.DISCOUNT_AMOUNT).HasColumnName("DISCOUNT_AMOUNT");
            this.Property(t => t.PATIENT_PRICE_LIST).HasColumnName("PATIENT_PRICE_LIST");
            this.Property(t => t.GUARANTOR1_PRICE_LIST).HasColumnName("GUARANTOR1_PRICE_LIST");
            this.Property(t => t.GUARANTOR2_PRICE_LIST).HasColumnName("GUARANTOR2_PRICE_LIST");
            this.Property(t => t.GUARANTOR1_COVERAGE_PLAN).HasColumnName("GUARANTOR1_COVERAGE_PLAN");
            this.Property(t => t.GUARANTOR2_COVERAGE_PLAN).HasColumnName("GUARANTOR2_COVERAGE_PLAN");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
        }
    }
}
